#include <stdio.h>
#define N 100000
int arr7[N+1]={0};

int main_31()
{
    int n,i,max,min;
    scanf("%d",&n);
    for (i=0;i<n ;i++ )
    {
        scanf("%d",&arr7[i]);
    }
    if (arr7[0]>arr7[n-1])
    {
        max=arr7[0],min=arr7[n-1];
    }else
    {
        max=arr7[n-1],min=arr7[0];
    }
    if (n%2==1)
    {
        printf("%d %d %d",max,arr7[n/2],min);
    }
    else
    {
        if ((arr7[n/2-1]+arr7[n/2])%2==0)
        {
            printf("%d %d %d",max,(arr7[n/2-1]+arr7[n/2])/2,min);
        }
        else
        {
            printf("%d %.1f %d",max,(arr7[n/2-1]+arr7[n/2])/2.0,min);
        }
    }
    return 0;
}
